package com.hh.vietnameseproject.ui.welcome

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Message
import androidx.appcompat.app.AppCompatActivity
import com.hh.vietnameseproject.databinding.ActivityWelcomeBinding
import com.hh.vietnameseproject.ui.login.LoginActivity

class WelcomeActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = ActivityWelcomeBinding.inflate(layoutInflater)
        setContentView(binding.root)
        binding.bgtitle.animate().translationY((-2400).toFloat()).setDuration(1200).startDelay = 3000
        binding.bgmain.animate().translationY((-2400).toFloat()).setDuration(1200).startDelay = 3000
        binding.myAnimation.animate().translationY(1600F).setDuration(1200).startDelay = 3000
        handler.sendEmptyMessageDelayed(0, 4 * 1000.toLong())
    }
    private val handler: Handler = object : Handler() {
        override fun handleMessage(msg: Message) {
            super.handleMessage(msg)
            val intent = Intent(this@WelcomeActivity, LoginActivity::class.java) //收到消息后跳转
            startActivity(intent)
            overridePendingTransition(0,0)
            finish()
        }
    }
}